package k8.wt;

import k8.SceneNode;
import k8.util.Camera;

/**
 * A Layer is an object used to get the available width and height at a defined
 * depth.
 */

public final class Layer extends SceneNode
{

	private float depth;
	private float width;
	private float height;

	private static float RadDeg = 57.2957795f;

	/** Creates a new instance of Layer */
	public Layer(float depth)
	{
		setDepth(depth);
	}

	/** Sets the depth */
	public void setDepth(float depth)
	{
		Camera camera = Camera.getInstance();
		float aspect = camera.getAspectRatio();
		int fov = camera.getFOV();
		
		this.depth = depth;
		this.width = (float) (depth * (fov / RadDeg));
		this.height = width / aspect;

		this.moveRight(-this.width / 2);
		this.moveUp(-this.height / 2);
		this.moveForward(depth);
	}

	/** Gets the depth */
	public float getDepth()
	{
		return depth;
	}

	/** Gets the width */
	public float getWidth()
	{
		return width;
	}

	/** Gets the height */
	public float getHeight()
	{
		return height;
	}

	@Override
	protected void transform()
	{
		// TODO Auto-generated method stub
	}

}
